<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div class="app">
        <h1>计算属性</h1>
        <input type="text" v-model="name">------->{{name.slice(0,1).toUpperCase()+name.slice(1)}}

        <h1>通过计算属性来做</h1>
        <input type="text" v-model="name">------->{{upperName}}

    </div>
    
</body>
<script>
    var vm = new Vue({
        el:".app", 
        data:{
            name:""
        },
        computed:{
            upperName(){
                return this.name.slice(0,1).toUpperCase()+this.name.slice(1)
            }

        }
    })
</script>

</html>